package GradeManager.StudentGradeSystem.common;

import GradeManager.StudentGradeSystem.pojo.Teacher;
import org.springframework.stereotype.Component;

public class CheckGradeIegal {
    private static String msg="成绩不合法！必须在 [0,150] 之间！";
    public static String checkGrades(Teacher grades){
        //        检验填写的成绩是否合法，并返回相应的错误信息
        if(grades.getChinese()==null&&grades.getMath()==null&&grades.getEnglish()==null){
            return "至少添加一门课程成绩!";
        }
        if(grades.getChinese()!=null && (grades.getChinese()<0 || grades.getChinese()>150)){
            return "语文"+msg;
        }
        if(grades.getMath()!=null && (grades.getMath()<0 || grades.getMath()>150)){
            return "数学"+msg;
        }
        if(grades.getEnglish()!=null && (grades.getEnglish()<0||grades.getEnglish()>150)){
            return "英语"+msg;
        }
        return "Iegal";
    }
}
